package com.sgb.goods.view.adapter;

import android.text.TextUtils;

import androidx.databinding.ViewDataBinding;

import com.chad.library.adapter.base.BaseViewHolder;
import com.sgb.goods.BR;
import com.sgb.goods.R;
import com.sgb.goods.databinding.GoodsItemVipPriceMangeBinding;
import com.sgb.goods.entity.VipPriceMangeListEntity;
import com.sgb.goods.utils.base.adapter.BaseCommonAdapter;

/**
 * 会员价列表适配器
 *
 * @author cyj
 */
public class VipPriceManageListAdapter extends BaseCommonAdapter<VipPriceMangeListEntity> {

    public VipPriceManageListAdapter() {
        super(R.layout.goods_item_vip_price_mange, BR.viewModel);
    }

    @Override
    protected void convert(BaseViewHolder baseHolder, ViewDataBinding dataBinding, VipPriceMangeListEntity entity) {
        GoodsItemVipPriceMangeBinding mDataBinding = (GoodsItemVipPriceMangeBinding) dataBinding;

        String pinpai = entity.brandName;
        if (!TextUtils.isEmpty(entity.brandName) && !TextUtils.isEmpty(entity.storageName)) {
            pinpai = entity.brandName + " | " + entity.storageName;
        } else if (!TextUtils.isEmpty(entity.storageName)) {
            pinpai = entity.storageName;
        }
        mDataBinding.tvPinpai.setText(!TextUtils.isEmpty(pinpai) ? pinpai : "/");
        baseHolder.addOnClickListener(R.id.tv_btn);
    }
}
